package com.os.util;

import com.alibaba.fastjson.JSONArray;
import com.os.sys.pojo.SysMenu;
import com.os.sys.pojo.SysOrg;
import com.os.sys.pojo.SysUser;
import com.os.sys.service.bean.ResultInfo;
import com.os.sys.service.bean.UserInfo;
import entity.Param;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.security.MessageDigest;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;

//import net.sf.json.JSONArray;
//import org.apache.commons.beanutils.BeanUtils;
//import org.apache.commons.lang.StringUtils;
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;

@Slf4j
public class Tools {
    //private static Log log = LogFactory.getLog(Tools.class);
    /**
     * 时间格式,示例: yyyy-MM-dd HH:mm:ss 示例值 2017-01-01 10:23:56
     */
    public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
    /**
     * 时间格式,示例: yyyyMMddHHmmss 示例值 20170101102356
     */
    public static final String DATE_FORMAT_NOW_2 = "yyyyMMddHHmmss";

//    public static Logger getLogger(){
//		if (log != null){
//			return log;
//		}
//
//		URL resource = Tools.class.getClassLoader().getResource("osLogConfig.xml");
//		//System.out.println(resource.getPath());
//		DOMConfigurator.configure(resource);
//		log=Logger.getLogger(BPConstants.JLE_LOG_STRATEGY);
//		return log;
//        return null;
//    }
    /**
     * 取所有小时的列表 00,01,....23
     * 返回字符串对象数组
     * @return List
     */
    public static List getHourList(){
        List hourList = new ArrayList();
        for(int i=0; i<24; i++){
            hourList.add(format(i));
        }
        return hourList;
    }

    public static List getMinuteList(){
        List minuteList = new ArrayList();
        for(int i=0; i<60; i++){
            minuteList.add(format(i));
        }
        return minuteList;
    }

    private static String format(int value){
        DecimalFormat df = new DecimalFormat("00");
        String formatedValue = df.format(value);
        return formatedValue;
    }
    /**
     * Get current time
     * @return String
     */
    public static String getNowTime() {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
        return (sdf.format(cal.getTime()));

    }

    /**
     * 判断某个文件是否存在
     * @param dir
     * @return
     */
    public static boolean isFileExist(String dir){
        File file=new File(dir);
        if (file.exists()) {
            return true;
        }
        //log.debug("文件："+dir+"不存在.");
        return false;
    }


    public static String code2code(String strIn, String sourceCode,
                                   String targetCode) {
        String strOut = null;
        if (strIn == null || (strIn.trim()).equals(""))
            return strIn;
        try {
            byte[] b = strIn.getBytes(sourceCode);
            for(int i = 0 ; i < b.length; i ++){
                System.out.print(b[i]+"  ");
            }
            System.out.println("");
            System.out.println("--------------------------------------------------------");
            strOut = new String(b, targetCode);
        }
        catch (Exception e) {
            e.printStackTrace();
            return null;
        }
        return strOut;
    }


    /***
     * MD5加码 生成32位md5码
     */
    public static String string2MD5(String inStr){
        MessageDigest md5 = null;
        try{
            md5 = MessageDigest.getInstance("MD5");
        }catch (Exception e){
            System.out.println(e.toString());
            e.printStackTrace();
            return "";
        }
        char[] charArray = inStr.toCharArray();
        byte[] byteArray = new byte[charArray.length];

        for (int i = 0; i < charArray.length; i++)
            byteArray[i] = (byte) charArray[i];
        byte[] md5Bytes = md5.digest(byteArray);
        StringBuffer hexValue = new StringBuffer();
        for (int i = 0; i < md5Bytes.length; i++){
            int val = ((int) md5Bytes[i]) & 0xff;
            if (val < 16)
                hexValue.append("0");
            hexValue.append(Integer.toHexString(val));
        }
        return hexValue.toString();

    }

    /**
     * 加密解密算法 执行一次加密，两次解密
     */
    public static String convertMD5(String inStr){

        char[] a = inStr.toCharArray();
        for (int i = 0; i < a.length; i++){
            a[i] = (char) (a[i] ^ 't');
        }
        String s = new String(a);
        return s;

    }
    /**
     * 计算编码的级别
     * @param codeStr  如100101000000
     * @param pace     如2
     * @return         如3， 当前代码级别为3级，
     * @example
     */
    public static int getCodeGrade(String codeStr, int pace){
        if(codeStr==null ||codeStr.equalsIgnoreCase("")){
            return -1 ;
        }
        if (codeStr.length()!=12){
            return -1 ;
        }
        if(codeStr.equalsIgnoreCase("000000000000")){
            return 0;
        }
        if(codeStr.endsWith("100000000000")){
            return 1;
        }
        if(codeStr.endsWith("0000000000")){
            return 1;
        }
        if(codeStr.endsWith("00000000")){
            return 2;
        }
        if(codeStr.endsWith("000000")){
            return 3;
        }
        if(codeStr.endsWith("0000")){
            return 4;
        }
        if(codeStr.endsWith("00")){
            return 5;
        }
        return 6;

    }

    /**
     * 计算编码的级别
     * @param codeStr  如100101000000
     * @return         如3， 当前代码级别为3级，
     * @example
     */
    public static int getCodeGradePace3(String codeStr){
        if(codeStr==null ||codeStr.equalsIgnoreCase("")){
            return -1 ;
        }
        if (codeStr.length()!=12){
            return -1 ;
        }
        if(codeStr.endsWith("000000000000")){
            return 0;
        }
        if(codeStr.endsWith("000000000")){
            return 1;
        }
        if(codeStr.endsWith("000000")){
            return 2;
        }
        if(codeStr.endsWith("000")){
            return 3;
        }

        return 4;

    }
    /**
     * 取某个列表中ID字段的字符串，连表用的
     * @param list
     * @param propertyName
     * @return 例如 1,2,3
     */
    public static String getIdsFromList(List list, String propertyName){
        String id_str = "";
        for(int i=0; i<list.size(); i++){
            Object obj = list.get(i);
            int val = (Integer)Tools.getObjectValue(obj, propertyName);
            id_str = id_str + val ;
            if(i<list.size()-1){
                id_str = id_str + "," ;
            }
        }
        return id_str ;
    }
    public static String getStr4Query(String str, String decorator){
        if(str==null){
            return "";
        }
        if(str.indexOf(",")<0){
            return decorator+str+decorator;
        }
        String[] strArr = str.split(",");
        String result = "";
        for(int i=0; i<strArr.length; i++){
            if(strArr[i].length()>0){
                result = result + decorator +strArr[i] +decorator;
            }
            if(i<strArr.length-1 && strArr[i].length()>0){
                result = result +",";
            }
        }
        return result;
    }
    /**
     * 取某个列表中ID字段的字符串，连表用的
     * @param list
     * @param propertyName 该属性类型要求为字符串型
     * @return 例如 a,b,c
     */
    public static String getStrFromList(List list, String propertyName){
        String id_str = "";
        for(int i=0; i<list.size(); i++){
            Object obj = list.get(i);
            String val = (String)Tools.getObjectValue(obj, propertyName);
            id_str = id_str + val ;
            if(i<list.size()-1){
                id_str = id_str + "," ;
            }
        }
        return id_str ;
    }
    /**
     * 取某个列表中ID字段的字符串，连表用的
     * @param list
     * @param propertyName 该属性类型要求为字符串型
     * @return 例如 a,b,c
     */
    public static String getStrFromListV2(List list, String propertyName){
        String id_str = "";
        for(int i=0; i<list.size(); i++){
            Object obj = list.get(i);
            String val = (String)Tools.getObjectValue(obj, propertyName);
            id_str = id_str + " '"+val+"' " ;
            if(i<list.size()-1){
                id_str = id_str + "," ;
            }
        }
        return id_str ;
    }
    /**
     * 取对象中某个属性的值
     * @param obj 对象
     * @param propertyName 属性名
     * @return
     */
    public static Object getObjectValue(Object obj, String propertyName){
        Class c = obj.getClass();
        Field[] fields = c.getDeclaredFields();
        Field.setAccessible(fields, true);
        try {
            for (Field field : fields) {
                //System.out.println(field.getType()+" "+field.getName()+"=="+field.get(obj));
                //System.out.println(field.getType().toString());
                if(field.getName().equalsIgnoreCase(propertyName)){
                    return field.get(obj);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 取对象中所有属性的串
     * @param obj 对象
     * @return
     */
    public static String getObjectStr(Object obj){
        String objStr = "";
        Class c = obj.getClass();
        Field[] fields = c.getDeclaredFields();
        Field.setAccessible(fields, true);
        try {
            for(int i=0; i<fields.length; i++){
                Field field = fields[i];
                objStr = objStr + field.getName()+":" + field.get(obj) ;
                if(i<fields.length-1){
                    objStr = objStr + "," ;
                }
            }
//		   for (Field field : fields) {
//			   objStr = objStr + field.getName() + field.get(obj) ;
//		    //System.out.println(field.getType()+" "+field.getName()+"=="+field.get(obj));
//		    //System.out.println(field.getType().toString());
//		    //if(field.getName().equalsIgnoreCase(propertyName)){
//		    	//return field.get(obj);
//		    //}
//		   }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return objStr;
    }

    /**
     * 取对象中某个字符串属性的值
     * @param obj 对象
     * @param propertyName 属性名
     * @return
     */
    public static String getStringValue(Object obj, String propertyName){
        Class c = obj.getClass();
        Field[] fields = c.getDeclaredFields();
        Field.setAccessible(fields, true);
        try {
            for (Field field : fields) {
                System.out.println(field.getType()+" "+field.getName()+"=="+field.get(obj));
                System.out.println(field.getType().toString());
                if(field.getName().equalsIgnoreCase(propertyName) && (field.getType().toString()).equalsIgnoreCase("class java.lang.String")){
                    return field.get(obj).toString() ;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 取某个对象中某个属生的类型
     * @param obj
     * @param propertyName
     * @return
     */
    public static String getFieldType(Object obj, String propertyName){
        Class c = obj.getClass();
        Field[] fields = c.getDeclaredFields();
        Field.setAccessible(fields, true);
        try {
            for (Field field : fields) {
                //System.out.println(field.getType()+" "+field.getName()+"=="+field.get(obj));
                //System.out.println(field.getType().toString());
                if(field.getName().equalsIgnoreCase(propertyName) ){
                    return field.getType().toString() ;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 取对象中某个字符串属性的值
     * @param  obj 对象
     * @param  propertyName 属性名
     * @return
     */
    public static int getIntValue(Object obj, String propertyName){
        Class c = obj.getClass();
        Field[] fields = c.getDeclaredFields();
        Field.setAccessible(fields, true);
        try {
            for (Field field : fields) {
                System.out.println(field.getType()+" "+field.getName()+"=="+field.get(obj));
                System.out.println(field.getType().toString());
                if(field.getName().equalsIgnoreCase(propertyName) && (field.getType().toString()).equalsIgnoreCase("class java.lang.String")){
                    return (Integer)field.get(obj) ;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return -999999;
    }
    /**
     * 打印对象列表，输了到日志
     * @param list
     */
    public static void printList(List list){
        if(list==null){
            return;
        }
        for(int i=0; i<list.size(); i++){
            Tools.printObject(list.get(i));
        }
    }
    /**
     * 打印对象，输了到日志
     * @param obj
     */
    public static void printObject(Object obj){
        String str = Tools.getObjectStr(obj);
        log.debug(str);
    }

    /**
     * 把对象数组转为json串.
     * @param list
     * @return
     */
    public static String toJsonString(List list)
    {
        return JSONArray.toJSONString(list);
        //JSONArray array = JSONArray.fromObject(list);
        //log.debug("List转JSON数据: "+array.toString());
        //return array.toString();
    }
    /**
     * 生成32位的UID串
     * @return
     */
    public static final String genUID(){
        UUID uuid = UUID.randomUUID();
        return uuid.toString();
    }
    /**
     * Get Current Month
     * @return
     */
    public static int getMonthNow(){
        Date now = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String nowtime = dateFormat.format( now );
        return Integer.valueOf(nowtime.substring(5,7));
    }
    /**
     * Get current year
     * @return String
     */
    public static int getCurrentYear() {
        Calendar cal = Calendar.getInstance();
        int year = cal.get(Calendar.YEAR);
        return year;
    }
    /**
     * 取某个季度的月份
     * @param qrt
     * @return
     */
    public static String getMonthStr(int qrt){
        if(qrt==1){
            return "1,2,3";
        }else if(qrt==2){
            return "4,5,6";
        }else if(qrt==3){
            return "7,8,9";
        }else if(qrt==4){
            return "10,11,12";
        }
        return "-1";
    }
    /**
     * 取当前时间
     * @return
     */
    public static String getTimeNow(){
        Date now = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String nowtime = dateFormat.format( now );
        return nowtime ;
    }
    /**
     * 取当前时间-按指定格式
     * 默认格式yyyyMMddHHmmss
     * @return
     */
    public static String getTimeNowByFormat(String format){
        //"yyyy-MM-dd HH:mm:ss"
        if(format==null || format.equalsIgnoreCase("")){
            format = "yyyyMMddHHmmss" ;
        }
        Date now = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        String nowtime = dateFormat.format( now );
        return nowtime ;
    }
    /**
     * 取当前时间
     * yyyy-MM-dd HH:mm:ss(默认格式)
     * yyyyMMddHHmmss
     * @return
     */
    public static String getTimeNow(String format){
        Date now = new Date();
        if(format==null || format.equalsIgnoreCase("")){
            format = "yyyy-MM-dd HH:mm:ss" ;
        }
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        String nowtime = dateFormat.format( now );
        return nowtime ;
    }
    /**
     * Get Current Data, format yyyy-MM-dd as 2010-01-01
     * @return
     */
    public static String getDateNow(){
        Date now = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String nowtime = dateFormat.format( now );
        return nowtime ;
    }
    /**
     * date - 格式: 2015-01-01
     * @return 2015年01月01日
     */
    public static String convertDate(String date){
        if(date==null || date.length()<10){
            return "";
        }
        return date.substring(0, 4)+"年"+date.substring(5, 7)+"月"+date.substring(8)+"日";
    }
//    /**
//     * date - 格式: 2015-01-01
//     * @return 2015年01月01日
//     */
//    public static String convertDate(String date, String format_new ){
//    	if(date==null || date.length()<10){
//    		return "";
//    	}
//    	if(format_new==null || format_new.equalsIgnoreCase("")){
//    		format_new = "yyyy年MM月dd日" ;
//    	}
//    	Date date1 = new Date();
//    	date1.setYear(Integer.valueOf(date.substring(0, 4)));
//    	date1.setMonth(Integer.valueOf(date.substring(5, 7)));
//    	date1.setDate(Integer.valueOf(date.substring(8)));
//    	SimpleDateFormat dateFormat = new SimpleDateFormat(format_new);
//    	String nowtime = dateFormat.format( date1 );
//    	return nowtime ;
//    }
    /**
     * 取两个集合的交集
     * properyName 依据的属性名
     */
    public static List getAndCollection(List list1, List list2, String properyName){
        List list = new ArrayList();
        for(int i=0; i<list1.size(); i++){
            Object obj = list1.get(i);
            String val = String.valueOf(Tools.getObjectValue(obj, properyName));
            for(int j=0; j<list2.size(); j++){
                Object obj2 = list2.get(j);
                String val2 = String.valueOf(Tools.getObjectValue(obj2, properyName));
                if(val.equalsIgnoreCase(val2)){
                    list.add(obj);
                    break;
                }
            }
        }
        log.debug("交集大小：" + list.size());
        return list;
    }
//    /**
//     * 取两个集合的差集
//     * properyName 依据的属性名
//     */
//    public static List getMinusCollection(List list1, List list2, String properyName){
//        List listAnd = Tools.getAndCollection(list1, list2, properyName);
//        if(listAnd.size()==0){
//            //没有交集
//            return list1 ;
//        }
//        Map andMap = Tools.getMapByList(listAnd, properyName, "");
//        List list = new ArrayList();
//        for(int i=0; i<list1.size(); i++){
//            Object obj = list1.get(i);
//            String val = String.valueOf(Tools.getObjectValue(obj, properyName));
//            if(andMap.get(val)==null){
//                list.add(obj);
//            }
//        }
//        log.debug("差集大小：" + list.size());
//        return list;
//    }
    /**
     * 取两个集合的并集
     */
    public static List getOrCollection(List list1, List list2, String properyName){
        Map map = new HashMap();
        List list = new ArrayList();
        for(int i=0; i<list1.size(); i++){
            Object obj = list1.get(i);
            String val = String.valueOf(Tools.getObjectValue(obj, properyName));
            if(map.get(val)!=null){
                continue;
            }else{
                list.add(obj);
                map.put(val, obj);
            }
        }
        for(int j=0; j<list2.size(); j++){
            Object obj2 = list2.get(j);
            String val2 = String.valueOf(Tools.getObjectValue(obj2, properyName));
            if(map.get(val2)!=null){
                continue;
            }else{
                list.add(obj2);
                map.put(val2, obj2);
            }

        }
        log.debug("并集大小：" + list.size());
        return list;
    }

    /**
     * 获取某个List的Map数据
     * 系统要依据传入的键名生成Map, 本方法的目的是更方便的查询List中的某个对象
     * @param list
     * @param key_name 返回的map键
     * @return Map<String,Object> Object代表list中的某个对象
     */
    public static Map<String,Object> getMapByList(List list, String key_name){
        Map<String,Object> map = new HashMap();
        for(int i=0; i<list.size(); i++){
            String key = getObjectValue(list.get(i), key_name)+"";
            map.put(key, list.get(i));
        }
        return map;
    }
//    /**
//     * 将List转为Map
//     * @param list
//     * @param propertyName1 属性名称
//     * @param propertyName2 属性名称  可选
//     * @return Map<String,Object> 返回(键值-原对象)的Map
//     */
//    public static Map<String,Object> getMapByList(List list, String propertyName1, String propertyName2){
//        Map<String,Object> map = new HashMap();
//        String id_str = "";
//        if(StringUtils.isBlank(propertyName1)){
//            return map;
//        }
//        for(int i=0; i<list.size(); i++){
//            Object obj = list.get(i);
//            String val1 = Tools.getObjectValue(obj, propertyName1).toString();
//            String val2 = "";
//            if(!StringUtils.isBlank(propertyName2)){
//                val2 = Tools.getObjectValue(obj, propertyName2).toString();
//                map.put(val1+"_"+val2, obj);
//            }else{
//                map.put(val1, obj);
//            }
//
//        }
//        return map ;
//    }
    /**
     * 两个列表相加
     * @param list1
     * @param list2
     * @return
     */
    public static List addList(List list1, List list2){
        List list = new ArrayList();
        if(list1==null){
            return list2;
        }
        if(list2==null){
            return list1;
        }
        for(int i=0; i<list1.size(); i++){
            list.add(list1.get(i));
        }
        for(int i=0; i<list2.size(); i++){
            list.add(list2.get(i));
        }
        return list;
    }
    /**
     * 判断两个字符串是否有交集
     * 调用者：DAO数据过滤
     * @param str1 示例 ,12,23,
     * @param str2 示例 ,5,12,99,
     * @return true 交集为12
     */
    public static boolean hasAndCol(String str1, String str2){
        return getAndCol(str1, str2).size()>0;
    }
    /**
     * 取两个字符串的交集，
     * @param str1 示例 ,12,23,
     * @param str2 示例 ,5,12,99,
     * @return 示例 list  {12}
     */
    private static List<String> getAndCol(String str1, String str2){
        //log.debug("str1 = "+str1+", str2="+str2);
        List<String> list = new ArrayList();
        String[] str_arr1 = str1.split(",");
        String[] str_arr2 = str2.split(",");
        for(int i=0; i<str_arr1.length; i++){
            if(str_arr1[i].length()==0){
                continue;
            }
            if(str2.indexOf(","+str_arr1[i]+",")>=0){
                list.add(str_arr1[i]);
            }
        }
        return list;
    }

    /**
     * 依据数据权限过滤列表数据
     * @param list
     * @param userinfo
     * @return
     */
    public static List filterList(List list , UserInfo userinfo){
        String org_ids_cansee = userinfo.getOrg_ids_cansee();
        List listnew = new ArrayList();
        for(int i=0; i<list.size(); i++){
            Object val = Tools.getObjectValue(list.get(i), "perm_org_ids");
            if(val!=null){
                if(Tools.hasAndCol((String)val, org_ids_cansee)){
                    listnew.add(list.get(i));
                }
            }
        }

        indexOrder(listnew);
        return listnew;
    }

    /**
     * 依据数据权限过滤列表数据
     * @param list
     * @param userinfo
     * @return
     */
    public static List filterList(List list ,UserInfo userinfo, String menu_id){
        log.debug("当前 = "+menu_id);

        String org_ids_cansee = userinfo.getOrg_ids_cansee();
        List listnew = new ArrayList();
        String user_sname = userinfo.getSysUser().getUser_sname();
        String user_id = userinfo.getSysUser().getUser_id();
        boolean onlyMySelf = false;
        //int menu_id_int = Integer.valueOf(menu_id);
        SysMenu menu = userinfo.getMenuFromMap(menu_id);
        if(menu!=null){
            if(menu.getMenu_perm()==BPConstants.Sys_Perm_OnlyCreator && !userinfo.isAdmin) {
                onlyMySelf = true;
            }
        }
//    	if(menu_id_int>0){
//    		if(" ,1504,1506,1508,1510,1512".indexOf(","+menu_id+",")>0 && !userinfo.isAdmin) {
//    			onlyMySelf = true;
//    		}
//    	}
//    	//具体业务处理
//    	if(menu_addr.indexOf("/plan.jsp")>0
//    			|| menu_addr.indexOf("/rec_dep.jsp")>0
//    			|| menu_addr.indexOf("/rec_center.jsp")>0
//    			|| menu_addr.indexOf("/rec_com.jsp")>0
//    			|| menu_addr.indexOf("/oplan.jsp")>0){
//    		//编制,只有自己可见
//    		if(!userinfo.isAdmin){
//    		    onlyMySelf = true;
//    		}
//    	}else{
//    		//部门主管级的数据, 部门经理审核, 部门经理只能看到自己部门的数据
//    		//_appr.jsp?otype=depd
//    		if(menu_addr.indexOf("/_appr.jsp")>0 &&
//    			 ( menu_addr.indexOf("otype=depd")>0 || menu_addr.indexOf("_dep.jsp")>0) ){
//
//    		}
//    		//部门经理级数据,总监审核的, 总监只能看到自己部门的经理提交的数据.
//    		//_appr.jsp?otype=dep
//
//    		//如果用户为总经理
//    		//如果用户为总监
//    		//如果用户为部门经理
//    	}
        //Object create_user_name = Tools.getObjectValue(list.get(i), "create_user_name");
        for(int i=0; i<list.size(); i++){
            Object val = Tools.getObjectValue(list.get(i), "perm_org_ids");
            if(val!=null){
                if(Tools.hasAndCol((String)val, org_ids_cansee)){
                    listnew.add(list.get(i));
                }
            }
        }

        try {
            if(onlyMySelf){
                //只有自己可见
                List listnew_myself = new ArrayList();
                for(int i=0; i<listnew.size(); i++){
                    Object val = Tools.getObjectValue(listnew.get(i), "create_user_id");
                    if(val!=null){
                        if((String.valueOf(val)).equalsIgnoreCase(user_id+"")){
                            listnew_myself.add(listnew.get(i));
                        }
                    }
                }
                indexOrder(listnew_myself);
                return listnew_myself ;
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        indexOrder(listnew);
        return listnew;
    }

    /**
     * 重置序号index列
     * @param list
     */
    public static List indexOrder(List list){
        try {
            for (int i = 0; i < list.size(); i++) {
                Object obj = list.get(i);
                setValue(obj, "index", i+1);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }

    /**
     * 重置序号index列
     * @param list
     * @param prop_name 属性名
     *
     */
    public static List indexOrder(List list, String prop_name, String page, String pageSize){
        //log.debug("page ="+page+", pageSize = "+pageSize);
        try {
            int pageInt = Integer.valueOf(page);
            int pageSizeInt =  Integer.valueOf(pageSize);
            for(int i=0; i<list.size(); i++){
                Object obj = list.get(i);
                setValue(obj, prop_name, i+1+((pageInt-1)*pageSizeInt));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }

    /**
     * 重置序号index列
     * @param list
     * @param prop_name 属性名
     *
     */
    public static List indexOrder(List list, String prop_name){
        //log.debug("page ="+page+", pageSize = "+pageSize);
        try {
            for(int i=0; i<list.size(); i++){
                Object obj = list.get(i);
                setValue(obj, prop_name, i+1);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }
    /**
     * 给一个对象的某个属性赋值
     * @param obj 要设置的属性的对象
     * @param propertyName  设置的属性名
     * @param setobj  属性的值
     */
    public static void setValue(Object obj, String propertyName,Object setobj){
        try {
            java.lang.Class objCla = (Class) obj.getClass();

            Field[] fs = objCla.getDeclaredFields();

            for(int i = 0 ; i < fs.length; i++){
                Field f = fs[i];
                if(f.getName().equalsIgnoreCase(propertyName)){
                    //设置些属性是可以访问的
                    f.setAccessible(true);
                    f.set(obj,setobj);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

//    public static void JsonStrToJavaObj(String jsonStr){
//    	jsonStr = "[{\"year\":\"2014\",\"pdlist\":[{\"month\":\"1\"},{\"month\":\"2\"}]}]";
////    	JSONObject obj = new JSONObject().fromObject(jsonStr);
////    	Plan plan = (Plan)JSONObject.toBean(obj,Plan.class);
////    	List list = new ArrayList();
////    	list.add(plan);
////    	Tools.toJsonString(list);
//
//    	JSONArray ja = JSONArray.fromObject(jsonStr);
//    	Map<String, Class<PlanDetail>> classMap = new HashMap<String, Class<PlanDetail>>();
//    	classMap.put("pdlist", PlanDetail.class);
//    	//Map<String, Class<List<PlanDetail>>> classMap = new HashMap<String, Class<List<PlanDetail>>>();
//    	List<Plan> list = JSONArray.toList(ja, Plan.class, classMap);
//    	Tools.toJsonString(list);
//    }
    /**
     * 除法
     * @param value1
     * @param value2
     * @return
     */
    public static double divide(Object value1, Object value2){
        if(value1==null || value2==null){
            return 0;
        }
        try {
            double v1 = (Double)value1;
            double v2 = (Double)value2;
            if(v2==0){
                return 0 ;
            }
            return v1/v2 ;
        } catch (NumberFormatException e) {
            e.printStackTrace();
            log.warn("类型转换失败", e);
        }
        return 0 ;
    }
    /**
     * 取中文数值
     * @param number
     * @return
     */
    public static String getNumberCN(int number){
        if(number==1){
            return "一";
        }else if(number==2){
            return "二";
        }else if(number==3){
            return "三";
        }else if(number==4){
            return "四";
        }else if(number==5){
            return "五";
        }else if(number==6){
            return "六";
        }else if(number==7){
            return "七";
        }else if(number==8){
            return "八";
        }else if(number==9){
            return "九";
        }else if(number==10){
            return "十";
        }else if(number==11){
            return "十一";
        }
        return "";
    }


    /**
     * 数值转中文,
     * 示例: 输入:11116.03 输出:壹仟壹佰壹拾陆点零叁
     * @param numberStr 数值串,可以支持小数
     * @return
     */
    public static String getNumberCN(String numberStr){
        String result = "";
        //String temp0 ="987.65";// "009081";
        String temp0 = numberStr+"";
        String temp = temp0;
        if (temp0.startsWith("0")) {
            temp = String.valueOf(Integer.parseInt(temp0));
            // System.out.println(Integer.parseInt(temp));
        }
        // int itemp = Integer.valueOf(temp);
        // System.out.println("String --> Integer"+itemp);
        StringBuffer retStrBuf =new StringBuffer();// 用来拼接数字串
        int dot =0; // 小数点位置
        int ivalue =0;// 保存每一个位上的数
        int len =0;// 保存数字的长度
        for (int i =0; i < temp.length(); i++) {
            System.out.print(temp.substring(i, i +1) +"");
        }
        System.out.println();
        String num[] = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
        String unit[] = { "亿", "拾", "佰", "仟", "万", "拾", "佰", "仟" };
        len = temp.length();
        if (temp ==null||"".equals(temp) || temp.length() <=0) {
            System.out.println("Input is null");
        } else {
            //(==-1)说明
            dot = temp.indexOf(".");
            if(dot ==-1){
                int i =0;
                // len-1这个注意,i在前面初始化为0
                for (i =0; i < len -1; i++) {
                    ivalue = Integer.parseInt(temp.substring(i, i +1));
                    retStrBuf.append(num[ivalue] + (unit[(len - i -1) %8]));
                    // System.out.print(num[ivalue]+(unit[(len - i - 1) % 8]));
                }
                // 单独取最后一位数
                ivalue = Integer.parseInt(String.valueOf(temp.substring(i, i +1)));
                // 最后一位为零,将不作处理
                if (ivalue !=0) {
                    retStrBuf.append(num[ivalue]);
                }
                //retStrBuf.append("元整");
                System.out.println(retStrBuf.toString());
                // System.out.println(","+num[ivalue]);
            }else{
                String tmpStr1 = temp.substring(0, dot);
                len = tmpStr1.length();
                int i =0;
                // len-1这个注意,i在前面初始化为0
                for (i =0; i < len -1; i++) {
                    ivalue = Integer.parseInt(temp.substring(i, i +1));
                    retStrBuf.append(num[ivalue] + (unit[(len - i -1) %8]));
                    // System.out.print(num[ivalue]+(unit[(len - i - 1) % 8]));
                }
                // 单独取最后一位数
                ivalue = Integer.parseInt(String.valueOf(temp.substring(i, i +1)));
                // 最后一位为零,将不作处理
                if (ivalue !=0) {
                    retStrBuf.append(num[ivalue]);
                }
                //跟整数处理不一样的部分
                if (dot < temp.length() -1) {
                    retStrBuf.append("点");
                    //从小数点后一位开始取
                    String tmpStr2 = temp.substring(dot +1);
                    len = tmpStr2.length();
                    //这里不需要len-1
                    for (i =0; i < len; i++) {
                        ivalue = Integer.parseInt(tmpStr2.substring(i, i +1));
                        retStrBuf.append(num[ivalue]);
                    }
                }
                //retStrBuf.append("元整");
                System.out.println(retStrBuf.toString());
            }
            result = retStrBuf.toString();
            result = result.replace("零拾", "零");
            result = result.replace("零佰", "零");
            result = result.replace("零仟", "零");
            result = result.replace("零万", "零");
            result = result.replace("零零", "零");
            result = result.replace("零零", "零");
        }
        return result ;
//    	String[] str={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
//    	//String ss[] = new String[]{"元","拾","佰","仟","万","拾","佰","仟","亿"}; String s=String.valueOf(d);
//    	String ss[] = new String[]{"","拾","佰","仟","万","拾","佰","仟","亿"}; String s=String.valueOf(d);
//    	System.out.println(s);
//    	StringBuffer sb=new StringBuffer();
//    	for(int i=0;i<s.length();i++){
//    	String index=String.valueOf(s.charAt(i));
//    	sb=sb.append(str[Integer.parseInt(index)]);
//    	}
//    	String sss=String.valueOf(sb);
//    	int i=0;
//    	for(int j=sss.length();j>0;j--){
//    	sb=sb.insert(j,ss[i++]);
//    	}
//    	return new String(sb);
        //System.out.println(sb);
    }

    /**
     * 向某个对象设置保留字段值
     * 包括: create_time, create_user_id, dep_id, dep_name, busi_uid, tasktype_uid, org_id_com, perm_org_ids
     * @param userinfo
     * @param obj 业务对象
     * @param valueMap 可以指定具体值,如果指定,则以该值为准,
     *        如 在map中存入 create_time, '20160301101023', 那么该值会被存入,否则会提取系统时间存入
     * @return
     */
    public static ResultInfo iniReservedField(UserInfo userinfo, Object obj, Map<String, String> valueMap){
        String create_time = Tools.getTimeNow();
        String create_user_id = userinfo.getSysUser().getUser_id()+"";
        String create_user_name = userinfo.getSysUser().getUser_sname();
        SysOrg org = userinfo.getMyFinalOrg();
        String busi_uid = Tools.genUID();
        //OrgBO.getInstance().getOrgInfo(org_id);
        String dep_id = org.getOrg_id()+"";
        String dep_name = org.getOrg_name();
        String tasktype_uid = "";
        String perm_org_ids = userinfo.getOrg_ids_cansee();
        String org_id_com = "9" ;
        if(valueMap!=null){
            //valueMap.get("busi_uid");
        }
        Tools.setValue(obj, "create_time", create_time);
        Tools.setValue(obj, "create_user_id", create_user_id);
        Tools.setValue(obj, "create_user_name", create_user_name);
        Tools.setValue(obj, "dep_id", dep_id);
        Tools.setValue(obj, "dep_name", dep_name);
        Tools.setValue(obj, "dep_name", dep_name);
        Tools.setValue(obj, "busi_uid", busi_uid);
        Tools.setValue(obj, "tasktype_uid", tasktype_uid);
        Tools.setValue(obj, "perm_org_ids", perm_org_ids);
        Tools.setValue(obj, "org_id_com", org_id_com);
        return new ResultInfo();
    }


    /**
     * 取某个季度的月份
     * @param qrt
     * @return
     */
    public static List<Integer> getMonthListByQrt(int qrt){
        List<Integer> monthList = new ArrayList();
        if(qrt==1){
            monthList.add(1) ;
            monthList.add(2) ;
            monthList.add(3) ;
        }else if(qrt==2){
            monthList.add(4) ;
            monthList.add(5) ;
            monthList.add(6) ;
        }else if(qrt==3){
            monthList.add(7) ;
            monthList.add(8) ;
            monthList.add(9) ;
        }else if(qrt==4){
            monthList.add(10) ;
            monthList.add(11) ;
            monthList.add(12) ;
        }
        return monthList;
    }
    /**
     * 取某个半年度的月份
     * @param half
     * @return
     */
    public static List<Integer> getMonthListByHalf(int half){
        List<Integer> monthList = new ArrayList();
        if(half==1){
            monthList.add(1) ;
            monthList.add(2) ;
            monthList.add(3) ;
            monthList.add(4) ;
            monthList.add(5) ;
            monthList.add(6) ;
        }else if(half==2){
            monthList.add(7) ;
            monthList.add(8) ;
            monthList.add(9) ;
            monthList.add(10) ;
            monthList.add(11) ;
            monthList.add(12) ;
        }
        return monthList;
    }

    public static int getQrtByMonth(int month){
        if(month>0 && month<=3){
            return 1;
        }else if(month<=6){
            return 2;
        }else if(month<=9){
            return 3;
        }else if(month<=12){
            return 4;
        }
        return 0 ;
    }
    public static int getHalfByMonth(int month){
        if(month>0 && month<=6){
            return 1;
        }else if(month<=12){
            return 2;
        }
        return 0 ;
    }
    /**
     * 取某个季度的月份
     * @param half
     * @return
     */
    public static String getMonthStrByHalf(int half){
        if(half==1){
            return "1,2,3,4,5,6";
        }else if(half==2){
            return "7,8,9,10,11,12";
        }
        return "-1";
    }

    private static void testGetCollection(){
        List<SysUser> list1 = new ArrayList();
        SysUser u1 = new SysUser();
        SysUser u3 = new SysUser();
        u1.setUser_id("1");
        u3.setUser_id("3");
        list1.add(u1);
        list1.add(u3);
        List<SysUser> list2 = new ArrayList();
        SysUser u2 = new SysUser();
        u2.setUser_id("1");
        SysUser u4 = new SysUser();
        u4.setUser_id("4");
        list2.add(u2);
        list2.add(u4);
        //getAndCollection(list1, list2,"user_id");
        getOrCollection(list1, list2,"user_id");
    }
    /**
     * 转换数值为指定格式输出
     * @param value
     * @param format
     * @return
     */
    public static String getDecimal(double value, String format){

        //java.text.NumberFormat nf = java.text.NumberFormat.getInstance();
        //nf.setGroupingUsed(false);
        //nf.format(value);
        //Double double1 = 123456789.123456789;
        //DecimalFormat decimalFormat = new DecimalFormat("#,##0.00");//格式化设置
        DecimalFormat decimalFormat = new DecimalFormat("###0.00");//格式化设置
        //可以控制是否使用科学计数法
        decimalFormat.setGroupingUsed(false);
        if(format==null ||format.equalsIgnoreCase("")){
            format = "###0.00" ;
        }else{
            decimalFormat = new DecimalFormat(format);
        }
        //System.out.println(decimalFormat.format(value));
        //System.out.println(value);
        //DecimalFormat df4 = new DecimalFormat("###.###");
        //return df3.format(12.34);
        return decimalFormat.format(value);
    }
    /**
     * 对小数进行格式化,按指定位数保留数据
     * @param value
     * @param scale 精度
     * @return
     */
    public static double getDecimal(double value, int scale){
        BigDecimal   b   =   new   BigDecimal(value);
        double   result   =   b.setScale(scale,   BigDecimal.ROUND_HALF_UP).doubleValue();
        return result;
    }
    /**
     * 复制属性
     * @param obj_source
     * @param obj_target
     */
    public static void copyProperties(Object obj_source, Object obj_target){
        try {
            BeanUtils.copyProperties(obj_target, obj_source);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    /**
     * 从字符串中取第一个值, 如  ,2,33,45,3,  取值为2
     * @param str
     * @return
     */
    public static String getFirstID(String str){
        String [] str_arr = str.split(",");
        for(int i=0; i<str_arr.length; i++){
            if(str_arr[i].trim().length()>0){
                return str_arr[i] ;
            }
        }
        return "0";
    }
    /**
     * 依据某个属性值去掉重复数据
     * @param  list
     * @param  key
     * @return 过滤重复数据后的List
     */
    public static List getDistinctList(List list, String key){
        List newList = new ArrayList();
        Map<String,String> map = new HashMap();
        for(int i=0; i<list.size(); i++){
            String obj_id = Tools.getObjectValue(list.get(i), key)+"";
            if(map.get(obj_id)==null){
                map.put(obj_id, "v");
                newList.add(list.get(i));
            }
        }
        return newList;
    }

    /**
     * 依据某个属性值过滤某个List
     * @param  list
     * @param  param
     * @return 过滤数据后的List
     */
    public static List getListByCondition(List list, Param param){
        String name = param.getPara_name();
        String value = param.getPara_value();
        String type = param.getPara_type();
        String cond_logic = param.getCond_logic();
        List newList = new ArrayList();

        for(int i=0; i<list.size(); i++){
            String obj_value= Tools.getObjectValue(list.get(i), name)+"";
            if(cond_logic.equalsIgnoreCase("=")){
                if(obj_value.equalsIgnoreCase(value)){
                    newList.add(list.get(i));
                }
            }else if(cond_logic.equalsIgnoreCase("like")){
                if(obj_value.indexOf(value)>=0){
                    newList.add(list.get(i));
                }
            }
        }
        return newList;
    }

    /**
     * 提取时间戳，示例： 1438860382435
     * @return
     */
    public static String getTimeMillStr(){
        return System.currentTimeMillis()+"";
    }

    /**
     * 获得随机数
     * @param min 最小值
     * @param max 最大值
     * @return int 介于最小值与最大值之前的随机数(可以与最小值或最大值相等)
     */
    public static int getRandom(int min,int max) {
        Random random = new Random();

        int s = random.nextInt(max)%(max-min+1) + min;
        return s;
    }

    /**
     * 取当前年份
     * @return
     */
    public static int getYearNow(){
        Date now = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String nowtime = dateFormat.format( now );
        return Integer.valueOf(nowtime.substring(0,4));
    }

    /**
     * 获取当前页面名称，如  list.jsp
     * @param request
     * @return
     */
    public static String getCurPageName(HttpServletRequest request){
        String requestURI = request.getRequestURI();
        String pageName = requestURI.substring(requestURI.lastIndexOf("/")+1);
        return pageName;
    }

    /*
     * 参数,要运算的字符串
     * return boolean
     * */
    public static boolean str2operation(String str){
        ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
        //String str = "100>200";
        boolean d;
        try {
            d = (Boolean) se.eval(str);
            return d;
        } catch (ScriptException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return false;
    }

    /*
     * >0 参数1大
     * ＝0相等
     * <0参数1小
     * */
    public static int dataCompare(String data1,String data2){
        int res=data1.compareTo(data2);
        return res;
    }

    /*
     * 文件名
     * 获取文件后缀
     * */
    public static String getFileNameNoEx(String filename) {
        if ((filename != null) && (filename.length() > 0)) {
            int dot = filename.lastIndexOf('.');
            if ((dot >-1) && (dot < (filename.length()))) {
                return filename.substring(0, dot);
            }
        }
        return filename;
    }

    public static String getAppUri(HttpServletRequest request)
    {
        return request.getContextPath();
    }

    public static String replaceBadCode(String str){
//    	if(true){
//    		return str;
//    	}
        if(str==null){
            return str;
        }
        while (str.indexOf("jQuery")>=0 && str.indexOf("_14")>=0 && (str.indexOf("_14") - str.indexOf("jQuery")<40)){
            try {
                str = str.replace(str.substring(str.indexOf("jQuery"), str.indexOf("_14")+14), "");
            } catch (Exception e) {
                log.error("替换jQuery出错！",e);
            }
        }
        if(str.indexOf("menu_addr")<0){
            while (str.indexOf("?")>=0 ){
                str = str.replace("?","");
            }
        }
        return str;
    }

    public static String replacePath(String path){
        if(path==null){
            return path;
        }
        return path.replace("\\", "/");
    }

    /**
     * 提取两字符串的不同部分
     * @param args1  1,2,3,4
     * @param args2  3,1,5
     * @return       2,4,5
     */
    public static String getStringDiffPart(String args1,String args2){
        String result="";
        String [] a1=args1.split(",");
        String [] a2=args2.split(",");
        List<String> list1=new ArrayList<String>( Arrays.asList(a1));
        HashSet hs1=new  HashSet(list1);
        list1.clear();
        list1.addAll(hs1);
        List<String> list2=new ArrayList<String>( Arrays.asList(a2));
        HashSet hs2=new  HashSet(list2);
        list2.clear();
        list2.addAll(hs2);
        for(String args:list2){
            if(list1.indexOf(args)<0){
                list1.add(args);
            }else{
                list1.remove(args);
            }
        }
        StringBuffer sbf=new StringBuffer();
        for(String args:list1){
            if(args.length()>0){
                sbf.append(args);
                sbf.append(",");
            }

        }
        if(sbf.length()==0){
            return "";
        }
        result=sbf.substring(0,sbf.length()-1).toString();
        return result;
    }


    /**
     * 提取两字符串的不同部分 以左侧字符串为基准，如果在右侧不存在，则提取出来
     * @param args1  1,2,3,4
     * @param args2  3,1,5
     * @return       2,4
     */
    public static String getStringDiffPartByLeft(String args1,String args2){
        String result="";
        String [] a1=args1.split(",");
        String [] a2=args2.split(",");
        List<String> list1=new ArrayList<String>( Arrays.asList(a1));
        HashSet hs1=new  HashSet(list1);
        list1.clear();
        list1.addAll(hs1);
        List<String> list2=new ArrayList<String>( Arrays.asList(a2));
        HashSet hs2=new  HashSet(list2);
        list2.clear();
        list2.addAll(hs2);
        for(String args:list2){
            if(list1.indexOf(args)<0){
                //list1.add(args);
            }else{
                list1.remove(args);
            }
        }
        StringBuffer sbf=new StringBuffer();
        for(String args:list1){
            if(args.length()>0){
                sbf.append(args);
                sbf.append(",");
            }

        }
        if(sbf.length()==0){
            return "";
        }
        result=sbf.substring(0,sbf.length()-1).toString();
        return result;
    }

    public static String getDistinctStr(String str){
        String result="";
        String [] a1=(","+str+",").split(",");
        Map<String,String> map = new HashMap();
        for(int i=0; i<a1.length; i++){
            if((","+str+",").indexOf(","+a1[i]+",")>=0  && map.get(a1[i])==null){
                result = result + ","+a1[i];
                map.put(a1[i], a1[i]);
            }
        }
        result = result +",";
        return result;
    }

    /**
     * 依据查询条件生成查询字符串
     * @param alis
     * @param paramList
     * @return
     */
    public static String genCondStr(String alis, List<Param> paramList){
        if(paramList==null){
            return "";
        }
        String alis_v = alis + (alis.equalsIgnoreCase("")?"":".");
        String str = " ";
        for(int i=0; i<paramList.size(); i++){
            Param param = paramList.get(i);
            if(param.getPara_value()==null || param.getPara_value().equalsIgnoreCase("")){
                continue;
            }
            if(param.getPara_type().equalsIgnoreCase("expr")){
                //表达式,直接连
                str = str+" and " + param.getPara_value();
                continue;
            }
            if(param.getPara_alias().equalsIgnoreCase("")){
                str = str+" and " + alis_v + param.getPara_name();
            }else{
                str = str+" and " + param.getPara_alias()+"." + param.getPara_name();
            }

            if(param.getCond_logic().indexOf("like")>=0){
                str = str+" like '%"+param.getPara_value()+"%' ";
            }else if(param.getCond_logic().indexOf("not in")>=0){
                str = str+" not in ("+param.getPara_value()+") ";
            }else if(param.getCond_logic().indexOf("in")>=0){
                str = str+" in ("+param.getPara_value()+") ";
            }else{
                str = str + param.getCond_logic();
                if(param.getPara_type().equalsIgnoreCase("String")){
                    str = str + "'"+param.getPara_value()+"'";
                }else if(param.getPara_type().equalsIgnoreCase("int")){
                    str = str + ""+param.getPara_value()+"";
                }else{
                    //默认视为字符串
                    str = str + "'"+param.getPara_value()+"'";
                }
            }
        }
        return str ;
    }

    private static void testGetDistinctList(){
        List list = new ArrayList();
        SysUser user = new SysUser();
        user.setUser_id("1");
        SysUser user2 = new SysUser();
        user2.setUser_id("1");
        list.add(user);
        list.add(user2);
        log.debug(Tools.getDistinctList(list, "user_id").size()+"");
    }



    public static void main(String [] args){
        System.out.println(true == Boolean.TRUE);
       // log.debug(getRandom(10,60));
        //testGetDistinctList();
        //log.debug(getDecimal(1.00555555556600001E10,""));
        //log.debug(getDecimal(1258474548.3000000000,"###0.0"));
        //log.debug(getDecimal(1,"%03d%n"));

        //String str1 = String.format("%04d", 1);
        //log.debug(str1);
        //double d = Double.valueOf("10000000000.123");
        //double d2 = Double.valueOf(getDecimal(1.00000000001E10,""));
        //log.debug(Double.toString(1.00000000001E10));

        //java.text.NumberFormat nf = java.text.NumberFormat.getInstance();
        //nf.setGroupingUsed(false);
        //log.debug(nf.format(d2));
        //log.debug(d2);
        //JsonStrToJavaObj("");
        //Client client = new Client();
        //client.setCli_name("");
        //VO vo = client;
        //log.debug(Tools.getFieldType(vo, "cli_name"));
        //log.debug(Tools.hasAndCol(",1,2,", ",2,3,"));
        //log.debug(Tools.getTimeNow(Tools.DATE_FORMAT_NOW_2));
    }
}
